package com.edu.service.impl;

import com.edu.bean.User;
import com.edu.dao.UserDao;
import com.edu.dao.impl.UserDaoImpl;
import com.edu.service.UserService;


import java.util.HashMap;
import java.util.Map;

public class UserServiceImpl implements UserService {
    UserDao ud = new UserDaoImpl();

    @Override
    public Map<String, Object> selectUser(String userName, String passWord) {
        Map<String,Object> result = new HashMap();
        User user = ud.selectUserNameAndPassWord(userName,passWord);
        System.out.println(user);
        if(user != null) {
            result.put("loginAdmin", user);
        }else {
            user = ud.selectUserName(userName);
            if(user != null) {
                result.put("msg", "密码错误");
            }else {
                result.put("msg", "账号不存在");
            }
        }
        return result;
    }
}
